package _bye_util;

import java.util.Stack;


public class ConstantLeakyRecycler implements IntRecycler
{
    private Stack< Integer > stack;
    private int nextInt;
    
    public ConstantLeakyRecycler() {
        this.stack = new Stack< Integer >();
        this.nextInt = 1;
    }
    
    public int newInt()
    {
        if ( this.stack.isEmpty() )
        {
            return this.nextInt++;
        }
        else
        {
            return this.stack.pop();
        }
    }
    
    public void recycleInt( int garbage )
    {
        this.stack.push( garbage );
    }
}
